<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gbk">
		<link href="css/style.css" rel="stylesheet" type="text/css">
		<title>维护入库单的结账单</title>
		<script type="text/javascript">
			var link;
			function buyInSettleMod( link ) {
				var d = document.forms[0];
				d.action = link;
				d.submit();
			}

			function buyInSettleDel( link ) {
				if (window.confirm("确认删除吗？")) {
					var d = document.forms[0];
					d.action = link;
					d.submit();
				} else {

				}
			}
		</script>
	</head>

	<body>
		<center>
			<h2>
				维护入库单的结账单
			</h2>
		</center>
		<div align="center">
			<table border="1">
				<tr>
					<td>入库单号：</td><td><s:property value="%{buyInMain.id}" /></td>
					<td>供应商：</td>  <td><s:property value="%{buyInMain.suppName}" /></td>
				</tr>
				<tr>
					<td>入库日期：</td><td><s:property value="%{buyInMain.buyDate}" /></td>
					<td></td><td></td>
				</tr>
				<tr>
					<td>入库单总额：</td>    <td><s:property value="%{settleRemain.needSettle}" /></td>
					<td>入库单已结金额：</td><td><s:property value="%{settleRemain.hasSettle}" /></td>
				</tr>
			</table>
			<br/>

			<form action="#" method="post">
			
				<s:hidden name="settleRemain.needSettle" value="%{settleRemain.needSettle}"/> <!-- 取不到 -->
				<s:hidden name="settleRemain.hasSettle"  value="%{settleRemain.hasSettle}"/>  <!-- 取不到 -->
				<s:hidden name="buyInMainId"  			 value="%{buyInMain.id}"/>	<!-- 目前是多余的 -->
				
				<table border="1" width="80%">
					<tr>
						<th>结账单号</th>
						<th>结账日期</th>
						<th>结款额</th><th>结账人</th><th>经手人</th><th>操作员</th>
						<th>维护</th>
					</tr>
					<s:iterator value="#request.buyInSettleList" id="buyInSettle">
						<tr>
							<td>
								<s:property value="#buyInSettle.id" />
							</td>
							<td>
								<s:property value="#buyInSettle.settleDate" />
							</td>
							<td>
								<s:property value="#buyInSettle.settleMoney" />
							</td>
							<td>
								<s:property value="#buyInSettle.settlerName" />
							</td>
							<td>
								<s:property value="#buyInSettle.handler" />
							</td>
							<td>
								<s:property value="#buyInSettle.operator" />
							</td>
							<td>
								<input type="button" value="修改" name="update" onclick="buyInSettleMod('prepareModBuyInSettle?buyInSettleId=<s:property value="#buyInSettle.id" />')" />
								<input type="button" value="删除" name="delete" onclick="buyInSettleDel('deleteBuyInSettle?buyInSettleId=<s:property value="#buyInSettle.id" />&buyInMainId=<s:property value="#buyInSettle.buyInId" />')" />
								<!-- “删除” 传第2个参数，是为了成功后，给 跳转的 Action传递参数 -->
							</td>
						</tr>
					</s:iterator>
				</table>
			</form>

			<br/>
			<a href="prepareAddBuyInSettle?buyInMainId=<s:property value="%{buyInMain.id}" />" >新增</a>  &nbsp; <!-- 先不改，后台仍 取不到 settleRemain 的信息 -->
			<a onclick="javascript:history.go(-1);" href="#">返回</a>

		</div>
	</body>
</html>